/*
 * Copyright (c) 2010 CCX(China) Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * CCX(China) Co.,Ltd. ("Confidential Information").
 * It may not be copied or reproduced in any manner without the express 
 * written permission of CCX(China) Co.,Ltd.
 *
 * Author: zhaosj
 * Date: 2010-4-9 下午12:37:24
 */
package com.test;

/**
 * @author Administrator
 *
 */
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

public class SetDemo {

	public static void test1() {
		Set set = new HashSet();
		List list = new LinkedList();
		list.add("1");
		list.add("2");
		set.add(list);
		set.add("a");
		set.add("b");

		Iterator it = set.iterator();
		while (it.hasNext()) {
			Object ob = it.next();
			if (ob instanceof List) {
				System.out.println(ob + " " + "true");
			} else {
				System.out.println(ob + " " + "false");
			}

			// System.out.println(ob + " === " + set.contains(ob));

		}
		System.out.println(set.size());
	}

	public static String[] getPointArray(int step) {

		try {
			int total = 240 / step; // 每天的基准点个数
			String[] array = new String[total];
			String start0 = "0930";
			String end0 = "1129";
			String start1 = "1259";
			String end1 = "1501";

			SimpleDateFormat sdf = new SimpleDateFormat("HHmm");

			Calendar calStart0 = Calendar.getInstance();
			calStart0.setTime(sdf.parse(start0));

			Calendar calEnd0 = Calendar.getInstance();
			calEnd0.setTime(sdf.parse(end0));

			Calendar calStart1 = Calendar.getInstance();
			calStart1.setTime(sdf.parse(start1));

			Calendar calEnd1 = Calendar.getInstance();
			calEnd1.setTime(sdf.parse(end1));

			for (int i = 0 , x = 0; i < 240 && x < total ; i++) {

				calStart0.add(Calendar.MINUTE, step);

				if (calStart0.before(calEnd0)
						|| (calStart0.after(calStart1) && calStart0
								.before(calEnd1))) {
					String anStringVar = sdf.format(calStart0.getTime());
					System.out.println(x + " " +anStringVar);
					array[x] = anStringVar; 
					x++ ;
				}

			}

		} catch (Exception e) {

			e.printStackTrace();

		}
		return null;
	}

	public static void serial() {

		int start = 0;
		int end = 305;

		String str = "";
		for (int i = start; i <= end; i++) {
			str += i + ",";
		}

		if (str.endsWith(","))
			str = str.substring(0, str.length() - 1);

		System.out.println(str);
	}

	public static void testArray() {

		double[] dd = { 1 };

		double[] ar = new double[5];
		for (int i = 0; i < ar.length; i++)
			ar[i] = i;

		dd = ar;

		System.out.println("len = " + dd.length);
		for (int i = 0; i < dd.length; i++)
			System.out.println(dd[i]);

	}
	
	public static void delay(long total)
	{
		long s = System.currentTimeMillis() ;
		for (int i = 0 ; i < total ; i++)
		{
			for (int j = 0 ; j < total ; j++)
			{
				;
			}
		}
		long e = System.currentTimeMillis() ;
		System.out.println((e - s)/1000);
	}

	/**
	 * @param args
	 */
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {

		serial();
		// testArray() ;
		//getPointArray(5) ;
		//delay(50000) ;

	}

}